Drawing Resources

ABSTRACT

This disclosure relates to drawing within a computer environment using a drawing resource. The computer environment includes a managed code portion and a native code portion. The computer environment compares a draw parameter call value being passed from the managed code portion to the native code portion with a stored drawing resource value stored in the native code portion. If the draw parameter call value is the same as the stored drawing resource value, then the computer environment is configured to draw onto a native drawing surface using the stored drawing resource. If the draw parameter call value is not the same as the drawing resource value, then a new drawing resource is created in the managed code portion. In another aspect, a portion of the drawing resource feature portion that contains data that describes at least one or more parameter of the drawing resource is transmitted between the managed code portion and the native code portion.

RELATED APPLICATION

This application is a divisional of and claims priority to U.S. patentapplication Ser. No. 10/293,448, filed on Nov. 13, 2002, the disclosureof which is incorporated by reference herein.

BACKGROUND

When executing code in a virtual machine (VM) environment, a userapplication program can run on different platforms. In such VM computerenvironments, native resources are typically allocated using systemcalls. In many computer-based drawing programs, a new drawing resource(such as a brush or a pen) is produced each time a new drawing object iscreated. Often, it is easy for developers to neglect the effects on theprocessor speed of producing a large number of drawing resources indrawing programs.

Managing each drawing resource generates system calls across a VM/nativeboundary between the managed code portion and the native code portion.System calls across this VM/native boundary demand considerableprocessor effort due to the varied code translations that may benecessary for virtual machines to comply with different computerplatforms and languages, as well as the considerable amount of data thatprecisely describes each drawing resource. The garbage collectionassociated with removing the large number of drawing resources isconsiderable since each drawing resource has to be consciously removedindividually, or alternately the drawing resources are removed aftersome prescribed period. If the drawing resources are removed after someperiod, then there may be a considerable number of drawing resourceswaiting for their duration to be removed. Storing such a considerablenumber of drawing resources may make such tasks as drawing programs slowin drawing programs. Additionally, present computer drawing programstypically produce multiple concurrently-saved copies of the drawingresource. For example, as the drawing resource is transferred betweenthe VM, the native OS, and the OS itself, a copy of each drawing objectis stored in memory associated with each location.

Drawing programs that run on such computer environments as stand alonecomputers, networked computer environments, and computer devicestypically inefficiently manage such drawing resources, but suchinefficiency is typically ignored due to the large processing abilitiesof these computer environments. Smaller and less powerful, memoryconstrained and processor constrained devices (i.e. resource constraineddevices) such as PDA's, cellular telephones, computer devices, embeddeddevices, microprocessor devices, and microcomputer devices are becomingincreasingly popular. Resource constrained devices rely on more limitedsoftware and operating systems than those applied to full sizecomputers. Applying a large number of system calls to resourceconstrained devices commonly makes the system prohibitively slow toperform many drawing functions. The code transitions necessary forsystem calls in resource constrained devices that have been producedbetween the native code portion and the managed code portion in virtualmachines (especially for demanding programs as drawing programs) are soprocessor intensive that the processor and memory resources becomehighly strained.

It would therefore be beneficial to improve the management of drawingresources within computer environments.

SUMMARY

This disclosure relates to a method and associated system for drawingwithin a computer environment with a drawing resource.

In one aspect, the computer environment includes a managed code portionand a native code portion. The computer environment compares a draw callvalue being passed from the managed code portion to the native codeportion with a stored drawing resource value stored in the native codeportion. If the draw call value is the same as the stored drawingresource value, then the system is already configured to draw using thestored drawing resource onto a native drawing surface included in thenative code portion using the stored drawing resource. If the draw callvalue is not the same as the drawing resource value, then a new drawingresource is created in the managed code portion, and that new drawingresource is selected into the native drawing surface.

In another aspect, a method of communicating between the managed codeportion and the native code portion includes transmitting a drawingresource feature portion from the managed code portion to a native codeportion. The data associated with the entire drawing resource does nothave to be transmitted. Managing the drawing resources in native codereduces the number of native drawing resources needed to be managed bythe native OS and reduces the number of system calls across theVM/native boundary between the managed code portion and the native codeportion. This reduction in the number of system calls results inincreases in efficiency and speed.

BRIEF DESCRIPTION OF THE DRAWINGS

The same numbers are used throughout the drawings to reference likefeatures and components.

FIG. 1 illustrates one embodiment of a computer environment integratinga virtual machine, the computer environment including a native codeportion and a managed code portion;

FIG. 2 illustrates one embodiment of the coded communications betweenthe native code portion and the managed code portion illustrated in FIG.1;

FIGS. 3 a and 3 b illustrate a flow chart of one embodiment of a drawingresource control method that may be performed on the computerenvironment shown in FIG. 1;

FIG. 4 illustrates one embodiment of an abstract graphics layer (AGL)that is contained in the native code portion of one embodiment of thecomputer environment;

FIG. 5 illustrates a flow chart of one embodiment of an idle method thatcan be performed by the computer environment shown in FIG. 1;

FIG. 6 illustrates one embodiment of drawing resource parameter stringthat contains information relating to prescribed parameters of a drawingresource, such as a brush or pen;

FIG. 7 illustrates one embodiment of a plurality of networked computersarranged within the virtual machine configuration; and

FIG. 8 illustrates a block diagram of the components associated with oneembodiment of a computer environment shown in FIG. 1.

DETAILED DESCRIPTION

Often, software developers wish to allow users to draw objects, barcharts, figures, etc. using drawing resources in an efficient manner. Indrawing programs, drawing resources draw using drawing primitives suchas lines, rectangles, etc. Drawing resources such as pens or brusheseach have drawing parameters that may include one or more of color,weight, style, and gradient. The drawing resource parameters relating totext include, for example, color, font, size, and style. This disclosuredescribes a drawing resource in which the user can control color, thoughit is understood that using other parameters in any drawing resource iswithin the scope of the parameters. One embodiment of drawing resourcethat is managed within a computer environment 100 is illustrated in FIG.1, which creates a drawing image 418 on a drawing surface 404 that isdescribed subsequently relative to FIG. 4.

In this disclosure, the term “drawing” refers to programs and processes(e.g., software and/or firmware) such as drafting, font, painting,graphics, etc. that allow users to generate and/or manipulate displayedobjects.

The FIG. 1 embodiment of computer environment 100 utilizes a virtualmachine (VM) architecture 202 to run on different platforms (i.e.,interface having different operating systems and different applicationprograms). The VM 202 uses a network framework (such as included inJava, or the .NET computer software produced and distributed byMicrosoft® Corporation). The computer environment 100 comprises anoperating system (OS) 526 and a computer or hardware 502, as describedbelow. In one embodiment, a cache which forms part of the native portionstores data from the system calls that is associated with one or morevaried drawing resources. The user interface of the VM 202 is intendedto be small and performance directed as to user input and how itdisplays information on the screen. The goals of the VM 202 includeenhancing the size, performance, and flexibility of the drawing program.

Though the concepts described here are applicable to all computerenvironments 100 in general including laptops, personal computers,networks, mainframes, etc.; they are especially beneficial to suchresource constrained devices (that have a relatively small processorand/or memory) as PDA's, cellular telephones, computer devices, embeddeddevices, microprocessor devices, and microcomputer devices. To providesome scale, such resource constrained devices are less than 1/20^(th) ofsize of many desktop or laptop computers (and often less than1/60^(th)). The relatively small size, and somewhat simplifiedoperation, of the resource constrained devices dictate that thedesigners program effectively and in a manner that complies withplatform guidelines.

The computer environment 100 includes a virtual machine (VM) 202 (whichincludes an application program 102 and a managed code portion 106), anative code portion 108, and an operating system (OS) 526. The managedcode portion 106 and the native code portion 108 contribute to a managedexecution process for the drawing program. The native code portion 108sits directly on the OS 526, and communicates using the native codelanguage of the OS. Therefore, the native code portion 108 compiles forthe OS 526 directly. As such, the native code portion 108 codes in suchnative computer languages as C, C++, Basic, etc. which the OS canhandle. The native code portion 108 contains such features, for example,as a just in time (JIT) compiler, a class loader, a garbage collector,an execution environment, and/or an interpreter.

The managed code portion 106 sits on top of the native code portion 108.The managed code portion contains a variety of class libraries that areutilized by the application program. One example of a class library thatis included in the managed code portion 106 is a graphic user interface(GUI) code library 110 which may be coded in byte code language (BCL)which is an intermediate language between the language of theapplication program 102 and that of the native code portion 108. The GUIlibrary 110 largely determines the characteristics of the interactionbetween the user of the computer environment 100 and the computerenvironment, and also determines the types of experience that the userwill have when using any particular application program.

One embodiment of the disclosure relates to decreasing the amount ofdata associated with signal calls, and more particularly draw calls.Instead of each system call containing the full amount of data necessaryto describe the drawing resource, one embodiment of the system callcontains a brief description of one characteristic of the drawingresource such as color. FIG. 6, as described below, illustrates storageof the red, green, and blue (RGB) color values. In this disclosure,brief system parameter calls are system calls that containcharacteristic parameter information relating to color, width, and/orother characteristics of the drawing reference. For example, a briefdraw call is called a draw parameter call. In general, system parametercalls are easier to formulate than system calls due to their shorterlength. Additionally, characteristic values (e.g., RGB values) stored insystem parameter calls are easier to compare with other values, process,and/or store than the values stored in system calls due to the smallerdata size (often 32 bit or less). By comparison, complete system callsare often four 32 bit integers (with each integer representing one ofred, green, blue, and alpha. It is the overhead of the custommarshalling (non-base system type, e.g., color vs. integer) that isactually the cost. It is especially beneficial to have system parametercalls traverse the boundary between the native code portion 108 and thenative code portion 106 due to the smaller dimensions, and ease oftranslating between the different codes, compared to system calls.

The user interface (UI) libraries commonly call code using system codesfrom a managed code portion 106 through to the native code portion 108to the operating system. Such system codes can be used to performrelatively low level functionality as drawing and window management. Themanaged code portion 106 is in the language of the user applicationprogram 102 and the intermediate language.

The identity of certain VMs 202 is evident from the output. For example,when a Java applet runs, a skilled user or developer can positivelyidentify it as a Java applet. Other embodiments of VMs, by comparison,are seamless and consistent with the native device application program.A pocket PC application running on the same VM 202 therefore looks andfeels differently from a smart phone application or an embeddedcontroller application. As such, the appearance and characteristics ofeach application program that runs on each respective OS 526 isprimarily determined by the developer of that particular applicationprogram, and not the particular VM. Each application program looks andfeels like the application program as developed by the developer for theOS 526.

The application or application program 102 is typically programmed by acode developer to provide the functionality of the computer environment100. The developer typically programs the code for the applicationprogram, and has the program compiled, loaded, and linked to create theexecutable file (.exe) for the application program. The .exe file isexecuted by the user of the computer environment 100 to run theapplication program, and therefore causes the application program toperform as desired by the user.

As illustrated in FIG. 1, the GUI library 110, the abstract graphicslayer (AGL) 112, and a user interface (UI) code layer 114 are containedwithin and associated with the managed code portion 106, the native codeportion 108, and the operating system 526, respectively. As such, systemparameter calls that are generated by the application program 102 (e.g.,by user input or program libraries) are transmitted through the GUIlibrary 110 of the managed code portion 106, to the AGL 112 of thenative code portion 108, and to the UI layer 114 of the OS 526.Similarly, certain system parameter calls that are generated by the OS526 are transmitted through the UI layer 114, to the AGL 112 in thenative code portion 108, to the GUI library 110 of the managed codeportion 106, and to the application program 102.

Greater interoperability between networked computer devices and/orenvironments 100 enhances the users and developers experience of drawingprograms and increase the acceptance of drawing programs that run onstand-alone computers and on such networks as the Internet, intranets,local area networks (LAN), and wide area networks (WAN). The computerenvironment 100 generally allows for such interoperability for manydifferent networked computer devices such as personal computers,telephones, workstations, PDAs, embedded controller devices, etc. thathave different operating systems and do not necessarily communicate orinterface well. Additionally, the computer environment 100 effectivelydisplays data originating from different drawing programs that run onthe same, or different, computers. As such, much of the data prepared byone application program or operating system and then processed and/orstored by many network servers can be considered “images” which shouldbe able to be effectively used by another application program or OS.

A user, or software developer, of the computer environment 100 shown inFIG. 1 can create a drawing resource within the AGL 112 in the followingexemplary manner. A drawing resource that is “created” has to go throughcertain processes, as described below, before it can be “drawn”. Thedrawing resource has to be drawn to be visible over a display of thecomputer environment 100. In the computer environment 100, the drawingresources are drawn in the native code portion 108 and/or the OS 526. Anapplication drawing surface 150 is initially created by the user ordeveloper interfacing with the application program 102 (e.g., in sourcecode, XML, or another programming language). Each application drawingsurface 150 can be considered as a window (or analogous to a piece ofpaper) with similar attributes to a window that will be displayed overthe window-based OS 526. At the level of the OS 526, the drawingresource is positioned to “draw” at a location on the OS drawing surface156.

For the purpose of this disclosure, it is important to differentiate“creating” a drawing resource from “drawing” with a drawing resource. Adrawing resource is created when it is initiated in the managed codeportion 106. During creation, if the drawing resource is created, itwill neither be realized in the OS 526 nor will it appear on the displayof the computer environment. When a drawing resource is used (describedin a draw parameter call being sent from the managed code portion 106 tothe native code portion 108), the drawing resource can be displayed onthe display of the computer environment because it is contained in thenative code portion 108.

FIG. 2 illustrates one embodiment of computer code 250 that may beutilized within the managed code portion 106 and the native code portion108 to control the operation of in the computer environment 100 shown inFIG. 1. The VM/native boundary 260 may be considered as the boundarybetween the managed code portion 106 and the native code portion 108.The computer code 250 includes the managed code portion 106 (that can beconsidered a part of the VM 202) and a native code portion 108. Anexecution engine of the VM 202 as shown in FIG. 1 may be considered toprocess intermediate code of some format, and thereby cause the desiredprogram to execute. Such an execution engine could exist on a variety ofOS, which may or may not be configured with virtual memory.

One embodiment of the managed code portion 106, as illustrated in FIG.2, includes a VM drawing specification object 256 and a VM drawingobject 258 (which are both in the managed code). The VM drawingspecification object 256 contains sufficient information to produce thedrawing specification object 256 in managed code and a native drawingobject 261. The native code portion 108 includes the native drawingobject 261, which is in the native code. When the user code creates adrawing resource in the managed code portion 106, as shown in FIG. 2,the object characterizing the drawing resource exists in the managedspace. Once the drawing resource is used in a draw parameter call, thevalue of the object is passed to native code portion 108, and the nativedrawing object 261 is not marshaled. The VM drawing specification object256, as illustrated by the information contained in FIG. 2, indicatesthat a rectangle will be drawn with brush b with coordinates 0, 0, 10,10. The draw parameter call that transfers data from the managed codeportion 106 to the native drawing object 261 of the native code portion108, extracts a color value and conveys the color value to the AGL 112of the native code portion. The native drawing object 261 in the AGL112, contains the characteristic parameter (e.g., color information),and not other information that clearly defines the characteristics ofthe drawing resource. As such, draw parameter calls convey colorinformation, but not the other information about the drawing resources.

The cache 113 in the AGL 112 that contains one or more drawing surfacesexists in native code portion 108. In one embodiment, the cache 113contains a first cached value for the last used drawing resource (e.g.,a red pen), while the cache contains a second cached value for eachrecently used drawing resource that contains different information(e.g., red pen and black pen). The cached value stored within the AGL112 may be null if the particular drawing resource is being used for thefirst time.

To illustrate more about system parameter calls and drawing usingdrawing resources within one embodiment of the drawing program run onthe computer environment 100, assume that the following commands are therequested inputs by the user of the computer environment 100: DRAWRECTANGLE (RED) DRAW CIRCLE (RED) DRAW CIRCLE (RED)

These three commands cause one red rectangle and two red circles to bedrawn on the OS drawing surface 156. Instead of drawing with threedistinct drawing resources (e.g., red brushes or pens) using theassociated draw parameter calls to produce the one rectangle and twocircles, the AGL 112 in the native code portion 108 creates a single reddrawing resource that is used by the OS 526 to draw the rectangle andthe two circles on the OS drawing surface 156.

The draw parameter call travels from the application program 102 via themanaged code portion 106 and the native code portion 108 (and to theoperating system 526) each time a drawing resource is drawn.Transmitting a large amount of data as associated with the prior-artsystem calls (compared to the smaller amount of data associated with thesystem parameter calls or draw parameter calls) between the managed codeportion 106 and the native code portion 108 is a processor taxing eventconsidering the code difference and the associated language translationbetween the managed code portion 106 and the native code portion 108. Assuch, reducing the data contained in at least some of the draw parametercalls diminishes the processor and memory load applied to the computerenvironment 100, which is especially important for resource constraineddevices.

In general, data relating to the drawing resources, drawing surfaces,and the associated system draw parameter calls migrate from theapplication program 102 to the operating system 526 as illustrated inFIG. 1. Such migration of data in system parameter calls flow from therespective application drawing surface 150 and application drawingsurface 151 in the application program 102; to the respective manageddrawing resource 152 and the managed drawing surface (not shown) in themanaged code portion 106; and to the respective native drawing resource158 and the native drawing surface (not shown) in the AGL 112 of thenative code portion 108. The characteristic data (e.g. colorinformation) of the native drawing resource 158 is applied to therespective OS drawing surface 156 and the OS drawing resource 160 withinthe operating system 526. System parameter calls that travel from theoperating system 526 to the application program pass through similarcomponents in the reversed direction.

To reduce the amount of data traveling between the application program102 and the native code portion 108, the number of system calls isreduced in system parameter calls and/or the amount of data containedwithin each system call is reduced for each system parameter call. Inone embodiment, one integer (packed) that represents the color value (8bits r, g, and b, potentially alpha as well=32 bits) is passed insteadof a custom type that needs to be marshaled to the nativerepresentation, ie: public struct Color { int red; int green; int blue;int alpha }

Such reduction in the amount of data transferred in system parametercalls is especially important to improve operational characteristics ofresource constrained devices. Though less data is transferred across aVM/native boundary 206 between the managed code portion 106 and thenative code portion 108; the data transferred within the systemparameter call is sufficient to determine whether the drawing resourcebeing transmitted within the system parameter call contains the same ora similar parameter (e.g., is red in color) to the drawing resourcepresently contained in a memory cache location. The term “similar” isused since slightly different parameter values that likely appearidentical on the display of the computer environment are within thescope of the present invention. For example, two slightly different RGBvalues, while literally different from each other, may be close enoughto produce indiscernible differences when displayed, and therefore beconsidered substantially the same. Additionally, different computersthat are communicating with each other, or different applicationprograms, may not be capable of transmitting the same value, andtherefore approximate values can be used.

If the drawing resource in the system parameter call does result in asimilar parameter within a drawing resource stored in the cache 113 inthe AGL 112, then the system parameter call and the associated datacorresponding to the drawing resource will not migrate to the OS, andthe logical representation of the drawing resource within the cache 113(more specifically the current cache value 406 shown in FIG. 4) in theAGL will be maintained in the cache. If, by comparison, the drawingresource in the system parameter call does not contain a similarparameter to the drawing resource in the AGL 112, then the systemparameter call and its associated data will migrate to the OS, and thelogical representations of the two drawing resources will be stored asthe current cache value 406 within the AGL 112.

During the system parameter call, the managed code portion 106, in bytecode language, system parameter calls across the VM/native boundary 206to the AGL 112 to draw the red rectangle and two red circles. Themanaged code portion 106 parameter calls to the AGL 112 to draw a redrectangle when the managed code portion attempts to draw using the firstred drawing resource in the OS 526. The AGL 112 then initiates logicalrepresentations of both the AGL drawing surface 157 and the AGL drawingresource 158 within the AGL 112. The AGL drawing resource 158 is thelogical representation of the OS drawing resource 160, and contains,e.g., color information that can be utilized by the OS drawing resource.The OS drawing resource 160 can be considered as the actual drawingresource residing within the OS 526. The characteristics of the OSdrawing surface are provided by the logical representation of the AGLdrawing surface 157 in the AGL 112.

For each drawing resource that is created and is used to draw as the OSdrawing resource 160, the computer environment follows the followingmethod. If the user wishes to create a drawing resource of the samecolor as one already created, the previously-created drawing resource ofthe same color (which is logically stored in the AGL 112 as the logicalrepresentation of the drawing resource) can be used to create the OSdrawing resource 160.

FIGS. 3 a and 3 b show one embodiment of drawing resource control method300 that manages the production of drawing resources within the computerenvironment 100 as illustrated in FIG. 1. The drawing resource controlmethod 300 provides for a small footprint of the VM 202 (i.e. thenetwork framework). This small footprint is important to allow thedrawing program to be applied to a broad range of resource constrainedcomputer devices or environments 100. This UI performance improvement ofthe drawing resource control method 300 configures the drawing resourcecontrol method to run indistinguishably from the manner intended by thedesigner of the native code.

During the drawing resource control method 300, the language relating tothe parameter calls is maintained in native code portion 108. As such,the code representing the drawing resource object need not be translatedas the drawing resource object is transferred between locations underthe control of the VM within the native code portion 108 and the nativeOS within the native code portion 108. The translation effort and timeis thus reduced as the drawing object is transferred between theinfluence of the VM and the influence of the native OS. The drawingresource control method 300, as shown as a method in FIGS. 3 a and 3 b,and also relative to the AGL 112 in FIG. 4, occurs at draw-time (i.e.,run time).

The functionality of multiple drawing resources can be provided using asingle drawing resource provided at least one parameter of the largenumber of drawing resources matches that of the single drawing resource.As such, for each drawing surface, if you use the same drawing parameter(e.g., color) in different drawing resources, the program does not haveto re-create the drawing resource each time a new drawing resource iscreated. Instead, a single drawing resource can provide thefunctionality of all of the drawing resources in any drawing surfacethat has the same parameter. The functionality of the drawing resourceis provided by caching the parameter(s) of the drawing resource in thecache 113 located in the AGL 112. At run time, the drawing resourceexists as a lightweight process model. In a single process of oneexecution environment, multiple application programs can run. Ifmultiple application programs are running at a single instant, then thecomputer environment can share drawing resources.

The drawing resource control method 300 of FIGS. 3 a and 3 b, as read inconjunction with the embodiment of the AGL 112 shown in FIGS. 1 and 4,provides one embodiment by which drawing resources are efficientlycreated and maintained so a drawing program can be utilized withoutcreating an excessive number of drawing resources to store in the OS526.

The description of the drawing resource control method 300 relates toFIGS. 3 a, 3 b, and 4. As illustrated in FIG. 4, there are two locationsthat serve as the cache 113 that are both contained within the AGL.First, there is a current RGB cache 406 that contains the currentcharacteristic value (e.g., color) of the OS drawing resource 160.Second, there is a global cache 415 that contains the storedcharacteristic value of the drawing resources that can be accessed andused to draw without requiring another draw call from the managed codeportion 106 to the native code portion 108. A pointer to the globalcache 415 provides one embodiment by which the plurality of drawingresources 428, 430 within the AGL 112 can be accessed. In FIG. 4, thedrawing resources 428 and 430 are displayed as being stored in theglobal cache 415 in the form of a linked list that uses pointertechnology. The global cache 415, however, can be arranged in any mannerthat permits storage, retrieval, and other management of the drawingresources 428 and 430 such as database, tabular, and other known datastorage techniques.

In FIGS. 3 a and 3 b, if a drawing resource can be located within thecurrent RGB cache 406 in the AGL 112 that is sufficiently similar to anew drawing resource that is transmitted from the managed code portion106, then the existing drawing resource in the native code portion canbe used and a new drawing resource does not have to be created.

One embodiment of the drawing resource control method 300, which occursprimarily in the native code portion 108, starts with a draw parametercall value being passed from the managed code portion 106 to the nativecode portion 108 during the draw parameter call. In 302, the currentcached value (which is stored in the current RGB cache 406 thatrepresents the characteristic color of the currently used drawingresource) is compared to the draw value received in the draw parametercall. If the current cached value in the current RGB cache 406 is thesame as the received draw value in decision 304, then the drawingresource control method 300 performs a draw operation in 304 using thedrawing resource defined by the cached characteristic color valuecontained in the OS drawing resource 160 as reflected by the current RGBcache 406.

If in decision 304, the cached value in the current RGB cache 406differs from the received draw value contained in the draw parametercall, the drawing resource control method 300 continues to 306. In theportion of the drawing resource control method 300 that follows decision304, an AGL drawing resource 158 as shown in FIG. 1 either has to befound in the global cache 415 or generated. In 306, the AGL 112 looks inthe global cache 415 within the AGL 112 for a stored cached value (thatcontains characteristic parameter information that is stored in aconfiguration similar to as shown in FIG. 6) corresponding to all thedrawing resources that can be accessed within the native code portion.

The drawing resource control method 300 continues to decision 308. Ifthe AGL 112 determines in decision 308 that there is a cached valuewithin the global cache 415 that equals, or is suitably close to, thereceived draw value contained in the draw parameter call, then the AGLuses the value stored in the global cache 415 to find the drawingresource. The process of finding the drawing resource uses the valuestored in the global cache 415 to access the corresponding OS drawingresource, in which the drawing resource control method 300 continues to314 as described below. If it is determined within the decision 308 thatthere is no cached value within the global cache 415 that equals, or issuitably close to, the received draw value contained in the drawparameter call, then the drawing resource control method 300 continuesto 310 in which the computer environment 100 starts to create a new AGLdraw resource. Following 310, the drawing resource control method 300then continues to 312 in which the AGL draw resource created in 310 isadded as the current cached RGB value 406 shown in FIG. 4. As such, anyfurther draw resource creations will detect the draw resource created in310 and 312 as having current cached RGB value 406.

The drawing resource control method 300 continues to 314 (followingeither 308 or 312 as described above) in which the reference count ofthe item in the cache 113 is increased to comply with the addition ofthe native draw object in the global cache 415. In one embodiment, thereference count is used to indicate whether a particular drawingresource is being actively utilized within a reasonable time frame, andtherefore whether the system should allocate the necessary memoryresources to maintain the drawing resource or whether the drawingresource should be destroyed. There are a variety of other embodimentsof counting mechanisms that may be used to accomplish the same result.When a particular drawing resource is no longer needed, it should bedestroyed so that the system can use that memory for other purposes. Theparticular time frame selected to return a drawing resource as activecan vary depending on the particulars of the drawing program, thedesigner's wishes, and the particulars of the computer environment 100.Associating the reference count with drawing resources such as pens,brushes, and fonts acts to ensure that similar drawing resources don'thave to be created and/or stored for each drawing resource object.

An object's reference count relates to the number of times that asimilar object has been requested. Each time an object is requested, thereference count is incremented. An application releases an object whenthat object is no longer needed, thereby decrementing the referencecount. As long as the reference count is greater than zero, the objectremains stored in the memory. An AGL object reference count isdecremented when the managed object counterpart is finalized during GCor manually disposed of. That's the only time the reference count goesdown. In one embodiment, the AGL object is often maintained with areference count equal to 0 until the application reaches the UI idlestate (defined to be the app state when there's no message pending inthe message queue) or there's GC memory pressure. The user does not needto know the reference count of an object. As long as the object'sinterfaces are obtained and released properly, the object will have theappropriate lifetime.

The number of drawing resources stored in the native code portion can becontrolled by cleaning each drawing resource from the native codeportion (i.e., the cache 113 in the AGL 112), when the reference countequals zero. In one embodiment, each drawing resource in the native codeportion can be removed if the user does not perform some actionindicating user activity relative to the drawing resource (for example,the user does not touch the keyboard and/or use the mouse for a second).

The drawing resource control method 300 continues to decision 316 inwhich an OS drawing resource 160 is accessed or created using the drawvalue contained within the stored or created AGL draw resource 158. Thedraw value is contained as the characteristic RGB value stored in theglobal cache 415 in the AGL draw resource 158. The characteristic RGBvalue can be stored as a 32 bit value as illustrated in FIG. 6, andtherefore the ease of transfer of the characteristic RGB value isrelatively easy. The OS drawing resource 160, by comparison, is a fulldrawing resource (compared to the drawing resource parameter string usedin the AGL, and described below relative to FIG. 6) since it containsthe necessary data to draw on the OS drawing surface 156.

The drawing resource control method 300 continues to 320 in which the OSdrawing resource is selected by the user to draw on the OS drawingsurface 156 as illustrated in FIGS. 3 a and 3 b. Each OS drawing surface156 may be associated with a plurality of OS drawing resources 160 thathave a different color (or other characteristic value). Each OS drawingsurface 156 may appear on the display of the computer environment 100 asa window that may be similarly interfaced with, such as other wordprocessing, spreadsheet, or other application programs. A single brush,pen, or font stored in the global cache 415 in the AGL can be accessedand selected to draw into multiple drawing surfaces simultaneously.

The drawing resource control method 300 continues to 322 in which thecharacteristic RGB color stored in the current RGB cache 406 (whichcontains the draw characteristic value stored in the AGL 112) is updatedwith the new RGB characteristic value. This ensures that the current RGBcache 406 in the AGL 112 contains the RGB characteristic valuecorresponding to the most-recently selected OS drawing resource 160.

The updated cached RGB characteristic value can be communicated betweenthe managed portion 106 and the native portion 108 (or within eitherportion) as a single cached red-green-blue (RGB) value (which may be 32bits, 64 bits, etc.). The data size of the cached RGB value which storescharacteristic information of the drawing resource is considerably lessthan the data size that would store the OS drawing resource itself. Forexample, each time a user generates a system parameter call relating toa drawing resource, before a new drawing resource object is created, thedrawing resource control method 300 determines whether a sufficientlysimilar drawing resource (which would provide a similar drawingoperation) has previously been created and is stored within the nativecode portion 108.

If a sufficiently similar OS drawing resource 160 has been created andis stored within the native code portion 108, then that previouslycreated drawing resource is used instead of creating a new OS drawingresource from scratch. As such, the number of system parameter callsassociated with creating a new drawing resource is reduced. Asillustrated in FIG. 4, the AGL 112 includes the pointer 408 that pointsto the location in the global cache 415, where one or more nativedrawing resource objects 428 and 430 are stored. Each native drawingresource objects 428 and 430 includes a reference count location.

Since the logical representation of the drawing resource (containing theRGB value) can be fully described with considerably less data than thefull OS drawing resource, using this technique results in a quickerproduction of the OS drawing resource 160 once the managed code portion106 requests the production of the OS drawing resource than in priorsystems that must create an entirely new drawing resource in theoperating system (and transfer the data associated with creating thepen). As such, the present system can use a just in time (JIT) compilerto transmit the draw parameter call. The performance of the JIT compileris improved when only a limited amount of data is being transferred, andthe transferred data is associated with a previously-compiled drawingresource. The effective use of JIT compilers not only improves theperformance of resource constrained devices such as PDAs, embeddeddevices, microprocessor-based devices and the like, but also provides aconsiderable performance enhancement in personal computers, laptops, andother full-size computer environments 100.

By storing only one drawing resource for each one of (or a plurality of)the drawing resource of the same color that were created in the managedcode portion 106 in the cache 113 of the AGL 112, the amount of datacontained in each of the system parameter calls from the managed codeportion 106 to the native code portion 108 is greatly reduced comparedwith system calls.

Garbage collection is simplified by the use of drawing resource controlmethod 300 due to limiting the actual number of OS drawing resources 160that are created. In prior systems, each draw call to the OS 526 wouldresult in the creation of a new OS drawing resource 160, regardless ofwhether there is already an OS drawing resource of the same color in theOS 526. As such, there may be hundreds, or even thousands, of OS drawingresources 160 of the same color stored in the OS 526. The drawingresource control method 300 limits the number of OS drawing resources ofthe same RGB (color) value to one. In even memory constrained devices,there is no need to garbage collect one OS drawing resource 160 for eachcolor which represents a relatively small amount of data. As such, thegarbage collection task is considerably simplified.

Considering that in complex drawing programs such as CAD/CAM, many userscreate hundreds, or even thousands, of drawing resources across multipleOS drawing surfaces, the reduction in the number of system calls (by theuse of system parameter calls which contain less data) greatlydiminishes the number of code transitions across the VM/native boundary206 between the managed code portion 106 to the native code portion 108.This diminution in the number of code transitions often reduces theprocessor load and improves the user's experience or the designer'sexpectations with the drawing programs, especially in resourceconstrained devices.

This storage (i.e., caching) of drawing resources contained in thenative code portion 108 or the operating system 526 is performed in amanner that allows signal parameter calls that describe the parametersof other drawing resources contained within the application program 102or the managed code portion 106 (prior to sending the other drawingresources to the native code portion 108) while limiting the amount ofdata transmitted between the managed code portion 106 and the nativecode portion 108.

Caching the drawing and other resources associated within the AGL 112 inthe native code portion 108 reduces the number of native resources thatmust be accessed from remote locations (e.g., from a server) during thecourse of a UI based application's lifetime, and thereby reduces thenumber of system calls across the VM/native boundary 260 between the VM202 and the native OS 208, 210. Limiting the amount of data contained ineach system call across the VM/native boundary 260 between the virtualcode portion 106 and the native code portion 108 acts to reduce therequisite data type marshaling overhead associated with such systemcalls compared to system parameter calls.

FIG. 5 illustrates one embodiment of a drawing resource idle method 450that is performed by the computer environment 100 when any drawingresource is idle, such as occurs when the user is not using or creatingthe AGL drawing resource 158 (which contains the RGB characteristicvalue). For example, the idle method 480 may be performed by thecomputer environment 100 when the user is not moving a mouse, so noinput is being provided relating to the AGL drawing resource.

During the drawing resource idle method 450 that is run in the AGL 112,code is run at 452 for each drawing resource that looks at the referencecount for the drawing resource. The AGL drawing resource 158 can beconsidered a node. The drawing resource idle method 450 continues todecision 454, in which the computer environment 100 considers whetherthe reference count of each AGL drawing resource 158 equals zero.

For each respective AGL drawing resource 158, if the answer to decision454 is yes, the drawing resource idle method 450 continues to 456 andthe drawing resource is deleted from the cache 113 (i.e. a memorylocation in the AGL 112 of the native code portion 108). If, bycomparison, the answer to decision 454 is no, then the drawing resourceidle method 450 continues to 458 in which the drawing resource ismaintained in the cache 113 in the native code portion 108 (moreparticularly the global cache 415). The drawing resource idle method 450therefore provides an effective technique to remove any drawing resourcethat is not being used for a reasonable period of time from the globalcache 415 by the native code portion 108. This action may be consideredas a form of garbage collection.

The methods described in this disclosure that are illustrated in FIGS. 3a, 3 b, and 5 are intended to streamline the computer processing, andtherefore provide an efficient method to allocate and to manage certainUI related OS resources. Such methods are especially suited to resourceconstrained devices. Even with the more powerful computers, though, itwould still be desirable to follow good programming techniques to reducethe number of system calls (and use system parameter calls) to make thecomputers run faster and more reliably, thereby increasing the user'senjoyment and use of such application programs. Such reduction of thenumber of system parameter calls across the VM/native boundary 260within any computer environment is within the intended scope of thepresent invention. One embodiment of a managed execution process of thepresent invention that is performed by the managed code portion 106 andthe native code portion 108 as shown in FIG. 1 follows these guidelines:

a) Choose a compiler to associate with the application program 102. Toobtain the benefits provided by the common language runtime, a developercan select one or more language compilers that target the runtime.

b) Compile the code to an intermediate language code (e.g., Microsoftintermediate language). This compiling translates the source code, XML,or other application program into the intermediate language, and alsogenerates associated metadata. The intermediate language is aCPU-independent set of instructions that can be efficiently converted tothe native code to ease the transition of data across the VM/nativeboundary 260 between the managed code portion 106 and the native codeportion 108. The intermediate language includes instructions forloading, storing, initializing, and calling methods on objects, as wellas instructions for arithmetic and logical operations, control flow,direct memory access, exception handling, and other operations. Themetadata describes such parameters as the types in the code, includingthe definition of each type, the signatures of each type's members, themembers that the code references, and the data that the runtime uses atexecution time.

c) Compile the intermediate level code into native code. The native codeportion 108 creates a native draw resource from a managed assembly andinstalls it into the native code portion 108 on the local computer. Anative draw resource that is a file containing compiledprocessor-specific machine code is produced. In this disclosure, thelogical representations of the drawing resources are referred to asbeing stored in the cache that is located in the AGL 112 of the nativecode portion 108. The actual drawing resource resides as the OS drawingresource 160 in the OS drawing surface 156. In different embodiments,the cache can be a physically distinct memory device that is set asideto store and retrieve drawing resources. Alternatively, the native codeportion cache can be a portion of random access memory (RAM) containedin the computer environment 100, as described below, that is typicallyused to store and/or retrieve other data.

In this embodiment of execution of the VM 202, at execution time, thejust-in-time (JIT) compiler in the native code portion 108 translatesthe intermediate language into the native code. During this compilation,the code passes a verification process that examines the intermediatelanguage code and metadata to find out whether the code can bedetermined to be type safe. Before the intermediate language can beexecuted, it must be converted by the just-in-time (JIT) compiler of theVM 202 to the native code. The native code is a CPU-specific code thatruns on the same computer architecture as the JIT compiler. Developerscan write a set of instructions for the intermediate level language thatcan be JIT-compiled and executed on computers with differentarchitectures. The managed code will run only on a specific operatingsystem if it calls platform-specific, native application programminginterfaces (API), or a platform-specific class library.

d) Execute the code. The common language runtime provides theinfrastructure that enables the code execution (as well as a variety ofservices that can be used during execution) to take place. Duringexecution, the OS drawing resource 160 is displayed on the OS drawingsurface 156, and responds to use input. As such, user input to thekeyboard or mouse of the computer environment 100 is mirrored by motionof the OS drawing resource 160 across the OS drawing surface. Before aprocess can be executed by the computer environment 100, it must becompiled to processor-specific code. Each process for which theintermediate language has been generated is JIT-compiled when it iscalled with a system parameter call for the first time, and thenexecuted. The next time the process is executed, the existingJIT-compiled native code is executed. The process of JIT-compiling andthen executing the code is repeated until execution is complete.

During execution, managed code receives services such as automaticmemory management, security, interoperability with unmanaged code,cross-language debugging support, and enhanced deployment and versioningsupport. After a native draw resource is generated for an assemblyprogram, the runtime automatically attempts to locate and use thisnative image each time it runs the assembly. If it is unable to find asuitable native image, the runtime reverts to a standard compiledprogram.

In the resource constrained computer environment 100 (e.g., certainnetworks and OS), reducing the number of resources used and increasingthe efficiency and retrieval rate of data is important. Certain OSarchitectures, such as NET and JAVA, involve the use of VMs (or managedcode portions 106) that are capable of interfacing with the softwarefrom more than one native machine (or native code portion 108). Whenexecuting code in the environment of the managed code portion 106, theuser interface (UI) components often represent hierarchical datastructures that typically allocate native resources to realize thedrawing resources. Executing code in the managed code portion 106necessitates that the drawing resources in the native code portion 108are synchronized with their counterparts in the managed code portion106. Synchronization between the managed code portion 106 and the nativecode portion 108 should be frequently performed to reduce anydifferences between the code describing the drawing resources in themanaged code portion 106 and the native code portion 108. Executing codein the native code portion 108, as is the case with the embodiment ofdrawing resource control method 300 shown in FIGS. 3 a and 3 b, limitsthe necessity for such synchronization.

In a network environment, including the computing environment 100 andthe remote computer 548 as described later relative to FIG. 8, each oneof the plurality of computers that form the computer environment 100 maybe running different application programs and operating systems, and mayhave different capabilities and purposes. The VM has the capability ofinterfacing with a plurality of computers simultaneously to affect suchnetworked activities as parallel processing with what appears to theuser of the VM as a non-networked computer environment. One of thegreatest challenges in creating an operating networked environment is toconfigure different computers having different operating systems topermit effective communication and data usage.

The embodiment of virtual machine 202 shown in FIG. 7 combines multiplecomputer environments having the same or different operating systems(e.g., Microsoft Windows, Unix, and Apple OS) to function as a singlecomputer environment. Also, eXtensible Markup Language (XML) is acomputer language that permits one application program to utilize and/ormodify the data produced by another application program. XML is an openindustry standard managed by the World Wide Web Consortium. The VM 202includes a first computer 204 having a first OS 208, and a secondcomputer 206 with a second OS 210. The first computer 204 may be remotefrom the second computer 206, necessitating the user of a network toprovide data communications. A user can access the VM 202 in a similarmanner as a user would interface with the computing environment 100 orthe remote computer 548.

The embodiment of VM 202 as shown in FIG. 7 most evidently interactswith the native OS in the client-server configuration within the networkenvironment when, for example, a first OS 208 associated with a firstcomputer 204 is interfacing with a second OS 210 associated with asecond computer 206. Where there are a variety of different native OS,it is important that the VM/native boundary 260 between the VM 202 andthe computers 204, 206 be configured in an operating system such as JAVAthat can interface with a variety of native operating systems.

One embodiment of the VM 202 is considered as an operating system thatruns the drawing resource (e.g., a computer pen, a computer paintbrush,or a computer font as illustrated in FIG. 4) within the managed codeportion 106 to create a drawn portion 418. The computer environment 100performs the method performed by the embodiment of computer environment100 shown in FIG. 7 by which the drawing resource can be controlled bythe user interface (UI) to the VM in the managed code portion 106. Datacorresponding to the drawing resources can be stored in one embodimentof the virtual cache memory which configures the user of the VM 202 toaccess the drawing resource using system parameter calls having limitedsystem latency compared to system calls between the VM 202 and thenative OS 208 and 210.

When executing code in the native code portion 108 (i.e., the VMenvironment), the UI libraries use the system parameter calls to performlow level functionality such as drawing and window management. In suchsystems, drawing resources within the native code portion 108 areallocated based on one or more UI library system parameter calls. Whenthe VM-managed code is finished with the resource, the drawing resourceis then freed.

In one aspect, it would be desirable to store the codes (i.e., of thesystem parameter calls) of the drawing resource that are transmitted tothe native code portion 108 in a VM managed memory included in themanaged code portion 106, such as the cache memory 113. The coderepresenting the drawing resources should be stored as native code inthe native code portion 108. A computer language such as XML can be usedto store the drawing resources in the managed code portion 106. XML isdesired because it allows different application programs to display,organize, program, edit, and transfer data relating to drawing resourcesbetween different web devices and application programs while maintainingthe ability to maintain the data characteristics.

XML separates the underlying data from the manner in which the data isdisplayed (and which may be controlled by the user). The data relatingto the drawing resources may be accessed and “unlocked” by each webdevice so that the underlying program may be displayed, organized,programmed, edited, and transferred between web devices. Additionally,the web device that access the data can format to display the underlyingdata as desired.

FIG. 6 illustrates one embodiment of a drawing resource parameter string700 that contains the characteristic RGB value which is transmittedbetween the managed code portion 106 and the native code portion 108 tomanage the drawing resources. The drawing resource parameter string 700includes a red-green-blue (RGB) color segment 701 and an optionaldrawing resource thickness segment 708. The RGB color segment 701includes a red value portion 702, a green value portion 704, and a bluevalue portion 706.

The red value portion 702, the green value portion 704, and the bluevalue portion 706 each contain data that together define the RGBcharacteristic value which can describe the OS drawing resource 160. Thecombination of the red value portion 702, the green value portion 704,and the blue value portion 706 (the RGB characteristic value) can becontained within 32 bits or 64 bits of data. As such, the amount of datathat has to be transmitted by the system parameter calls in transferringdata relating to colors of drawing resources is relatively small, and isconsiderably smaller than the amount of data necessary to create anentire drawing resource which is contained in system calls.

Additionally, the amount of processor effort and memory storage space(e.g., storage space in the cache 113) allocated to comparing these 32or 64 bit color values (including the red value portion, the green valueportion, and the blue value portion of the RGB characteristic value) fordrawing resources is much less than the respective processor effort andmemory storage necessary to compare the larger amount of data describingthe entire drawing resource. As such, the drawing resource controlmethod 300 illustrated in FIGS. 3 a and 3 b, as well as the drawingresource idle method 450 illustrated in FIG. 5, can be performed quickerand more reliably by resource-constrained devices.

In certain embodiments, the drawing resource parameter string 700includes the drawing resource dimension portion 708. The drawingresource dimension portion 708 can be used to describe the dimensions ofthe drawing object, and is used to manage (e.g., create, destroy, and/ormaintain) drawing resources between the managed code portion 106 and thenative code portion 108 in a similar manner (using an additionalcriterion) as described for each of the red value portion 702, the greenvalue portion 704, and the blue value portion 706. The drawing resourcedimension portion 708 can be used to measure thickness of a primitiveline, dimension of a primitive object, font of a primitive letter ornumber, etc. The drawing resource dimension portion 708 can therefore beused to provide a considerable amount of information about a drawingresource utilizing a relatively small amount of data.

FIG. 8 illustrates an example of a suitable computer environment 100 ornetwork 100 which includes a user interface having hierarchicalcontrols. The computer environment 100 manages drawing resources usingthe methods described above. The computer environment 100 can interfacewith the UI to cause the VM 202 and/or the native OS 208, 210 to performthe desired drawing function. To accomplish this, the computerenvironment 100 can perform the embodiment of drawing resource controlmethod 300 shown in FIGS. 3 a and 3 b as well as the idle method 480illustrated in FIG. 5.

The computer environment 100 illustrated in FIG. 8 is a general computerenvironment, which can be used to implement the techniques describedherein. The computer environment 100 is only one example of a computerenvironment and is not intended to suggest any limitation as to thescope of use or functionality of the computer and network architectures.Neither should the computer environment 100 be interpreted as having anydependency relating to any one or combination of components illustratedin the exemplary computer environment 100.

The computer environment 100 includes a general-purpose computing devicein the form of a computer 502. The computer 502 can be, for example, oneor more of a stand alone computer, a networked computer, a mainframecomputer, a PDA, a telephone, a microcomputer or microprocessor, or anyother computer device that uses a processor in combination with amemory. The components of computer 502 can include, but are not limitedto, one or more processors or processing units 504 (optionally includinga cryptographic processor or co-processor), a system memory 506, and asystem bus 508 that couples various system components including theprocessor 504 and the system memory 506.

The system bus 508 represents one or more of any of several types of busstructures, including a memory bus or memory controller, a peripheralbus, an accelerated graphics port, and a processor or local bus usingany of a variety of bus architectures. By way of example, sucharchitectures can include an Industry Standard Architecture (ISA) bus, aMicro Channel Architecture (MCA) bus, an Enhanced ISA (EISA) bus, aVideo Electronics Standards Association (VESA) local bus, and aPeripheral Component Interconnects (PCI) bus also known as a Mezzaninebus.

The computer 502 typically includes a variety of computer readablemedia. Such media can be any available media that is accessible bycomputer 502 and includes both volatile and non-volatile media, andremovable and non-removable media.

The system memory 506 includes computer readable media in the form ofnon-volatile memory such as read only memory (ROM) 512, and/or volatilememory such as random access memory (RAM) 510. A basic input/outputsystem (BIOS) 514, containing the basic routines that help to transferinformation between elements within computer 502, such as duringstart-up, is stored in the ROM 512. The RAM 510 typically contains dataand/or program modules that are immediately accessible to, and/orpresently operated on, by the processing unit 504.

The computer 502 may also include other removable/non-removable,volatile/non-volatile computer storage media. By way of example, FIG. 8illustrates a hard disk drive 515 for reading from and writing to anon-removable, non-volatile magnetic media (not shown), a magnetic diskdrive 518 for reading from and writing to a removable, non-volatilemagnetic disk 520 (e.g., a “floppy disk”), and an optical disk drive 522for reading from and/or writing to a removable, non-volatile opticaldisk 524 such as a CD-ROM, DVD-ROM, or other optical media. The harddisk drive 515, magnetic disk drive 518, and optical disk drive 522 areeach connected to the system bus 508 by one or more data mediainterfaces 527. Alternatively, the hard disk drive 515, magnetic diskdrive 518, and optical disk drive 522 can be connected to the system bus508 by one or more interfaces (not shown).

The disk drives and their associated computer readable media providenon-volatile storage of computer readable instructions, data structures,program modules, and other data for computer 502. Although the exampleillustrates a hard disk within the hard disk drive 515, a removablemagnetic disk 520, and a non-volatile optical disk 524, it is to beappreciated that other types of computer readable media which can storedata that is accessible by a computer, such as magnetic cassettes orother magnetic storage devices, flash memory cards, CD-ROM, digitalversatile disks (DVD) or other optical storage, random access memories(RAM), read only memories (ROM), electrically erasable programmableread-only memory (EEPROM), and the like, can also be utilized toimplement the exemplary computing system and environment.

Any number of program modules can be stored on the hard disk containedin the hard disk drive 515, magnetic disk 520, non-volatile optical disk524, ROM 512, and/or RAM 510, including by way of example, the OS 526,one or more application programs 528, other program modules 530, andprogram data 532. Each OS 526, one or more application programs 528,other program modules 530, and program data 532 (or some combinationthereof) may implement all or part of the resident components thatsupport the distributed file system.

A user can enter commands and information into the computer 502 viainput devices such as a keyboard 534 and a pointing device 536 (e.g., a“mouse”). Other input devices 538 (not shown specifically) may include amicrophone, joystick, game pad, satellite dish, serial port, scanner,and/or the like. These and other input devices are connected to theprocessing unit 504 via input/output interfaces 540 that are coupled tothe system bus 508, but may be connected by other interface and busstructures, such as a parallel port, game port, or a universal serialbus (USB).

A monitor 542 or other type of display device can also be connected tothe system bus 508 via an interface, such as a video adapter 544. Inaddition to the monitor 542, other output peripheral devices can includecomponents such as speakers (not shown) and a printer 546 which can beconnected to computer 502 via the input/output interfaces 540.

Computer 502 can operate in a networked environment using logicalconnections to one or more remote computers, such as a remote computingdevice 548. By way of example, the remote computing device 548 can be apersonal computer, portable computer, a server, a router, a networkcomputer, a peer device or other common network node, game console, andthe like. The remote computing device 548 is illustrated as a portablecomputer that can include many or all of the elements and featuresdescribed herein relative to computer 502.

Logical connections between computer 502 and the remote computing device548 are depicted as a local area network (LAN) 550 and a general widearea network (WAN) 552. Such networking environments are commonplace inoffices, enterprise-wide computer networks, intranets, and the Internet.

When implemented in a LAN networking environment, the computer 502 isconnected to a local network 550 via a network interface or adapter 554.When implemented in a WAN networking environment, the computer 502typically includes a modem 556 or other means for establishingcommunications over the wide network 552. The modem 556, which can beinternal or external to computer 502, can be connected to the system bus508 via the input/output interfaces 540 or other appropriate mechanisms.It is to be appreciated that the illustrated network connections areexemplary and that other means of establishing communication link(s)between the computers 502 and 548 can be employed.

In a networked environment, such as that illustrated with computerenvironment 100, program modules depicted relative to the computer 502,or portions thereof, may be stored in a remote memory storage device. Byway of example, remote application programs 558 reside on a memorydevice of remote computer 548. For purposes of illustration, applicationprograms and other executable program components such as the operatingsystem are illustrated herein as discrete blocks, although it isrecognized that such programs and components reside at various times indifferent storage components of the computing device 502, and areexecuted by the data processor(s) of the computer. It will beappreciated that the network connections shown and described areexemplary and other means of establishing a communications link betweenthe computers may be used.

Various modules and techniques may be described herein in the generalcontext of computer executable instructions, such as program modules,executed by one or more computers or other devices. Generally, programmodules include routines, programs, objects, components, datastructures, etc. that perform particular tasks or implement particularabstract data types. Typically, the functionality of the program modulesmay be combined or distributed as desired in various embodiments.

An implementation of these modules and techniques may be stored on ortransmitted across some form of computer readable media. Computerreadable media can be any available media that can be accessed by acomputer. By way of example, and not limitation, computer readable mediamay comprise “computer storage media” and “communications media.”

“Computer storage media” includes volatile and non-volatile, removableand non-removable media implemented in any method or technology forstorage of information such as computer readable instructions, datastructures, program modules, or other data. Computer storage mediaincludes, but is not limited to, RAM, ROM, EEPROM, flash memory or othermemory technology, CD-ROM, digital versatile disks (DVD) or otheroptical storage, magnetic cassettes, magnetic tape, magnetic diskstorage or other magnetic storage devices, or any other medium which canbe used to store the desired information and which can be accessed by acomputer.

“Communication media” typically embodies computer readable instructions,data structures, program modules, or other data in a modulated datasignal, such as carrier wave or other transport mechanism. Communicationmedia also includes any information delivery media. The term “modulateddata signal” means a signal that has one or more of its characteristicsset or changed in such a manner as to encode information in the signal.By way of example, and not limitation, communication media includeswired media such as a wired network or direct-wired connection, andwireless media such as acoustic, RF, infrared, and other wireless media.Combinations of any of the above are also included within the scope ofcomputer readable media.

Although the systems and methods have been described in languagespecific to structural features and/or methodological steps, it is to beunderstood that the invention defined in the appended claims is notnecessarily limited to the specific features or steps described. Rather,the specific features are disclosed as preferred forms of implementingthe claimed invention.

1. A method of communicating between a managed code portion and a nativecode portion, comprising: transmitting a drawing resource featureportion that contains data that describes at least one aspect of thedrawing resource from a managed code portion to a native code portion,but not transmitting an entire drawing resource.
 2. One or morecomputer-readable storage media having computer-readable instructionstherein that, when executed by a computing device, cause the computingdevice to perform acts comprising: transmitting a drawing resourcefeature portion that contains data that describes at least one aspect ofa drawing resource from a managed code portion to a native code portion,but not transmitting an entire drawing resource.
 3. An apparatuscomprising: a computing device; one or more processors; and one or morecomputer-readable storage media having computer-readable instructionstherein that, when executed by the computing device, cause the computingdevice to perform acts comprising: transmitting a drawing resourcefeature portion that contains data that describes at least one aspect ofa drawing resource from a managed code portion to a native code portion,but not transmitting an entire drawing resource.